package com.websocet.controller;

import com.websocet.domain.B;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @Author: 陈玉鹏
 * @Description: TODO
 * @DateTime: 2023/2/21 22:02
 */
public class TestTwoList {

//    public static void main(String[] args) {
//        List<String> list = Arrays.asList("AA","BB","CC");
//        List<String> listSum = Arrays.asList("AA","BB","CC","DD");
//        listSum.forEach(item->{
//            if (!list.contains(item)) {
//                System.out.println(item);
//            }
//        });
//
//    }
    public static void main(String[] args) {
        List<B> list = new ArrayList<>();
        B a = new B("a","a");
        B a1 = new B("a1","a1");
        B a2 = new B("a2","a2");
        list.add(a);
        list.add(a1);
        list.add(a2);
        List<B> listSum = new ArrayList<>();
        B a22 = new B("a","a");
        B a23 = new B("a1","a1");
        B a24 = new B("a2","a2");
        B a25 = new B("a25","a2");
        listSum.add(a22);
        listSum.add(a23);
        listSum.add(a24);
        listSum.add(a25);
        List<B> lastSum = new ArrayList<>();
//        listSum.forEach(item->{
//            if (!list.contains(item)) {
//                lastSum.add(item);
//            }
//        });
        listSum.forEach(item->{
            list.forEach(e->{
                if (item.getName().equals(e.getName())) {
                    lastSum.add(e);
                }
            });

        });
//        List<B> collect = listSum.stream().filter(e -> !list.contains(e)).collect(Collectors.toList());
        System.out.println(lastSum);
    }


}

